﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GA.Shared.Interfaces;
using System.Windows;
using System.Collections.ObjectModel;
using System.Runtime.Serialization;
using System.Windows.Data;
using GA.Server.DatabaseManager;
using GA.Shared.Objects;

namespace GA.Server.Objects
{
    public class DatabaseFacility : DatabaseObject
    {
        /// <summary>
        /// Identifies the Id Property.
        /// </summary>
        public static readonly DependencyProperty IdProperty =
            DependencyProperty.Register(
                "Id",
                typeof(int),
                typeof(DatabaseFacility),
                new PropertyMetadata(-1));

        /// <summary>
        /// Identifies the FacilityTypeId Property.
        /// </summary>
        public static readonly DependencyProperty FacilityTypeIdProperty =
            DependencyProperty.Register(
                "FacilityTypeId",
                typeof(int?),
                typeof(DatabaseFacility),
                new PropertyMetadata(null));

        /// <summary>
        /// Identifies the FacilityType Property.
        /// </summary>
        public static readonly DependencyProperty FacilityTypeProperty =
            DependencyProperty.Register(
                "FacilityType",
                typeof(FacilityType),
                typeof(DatabaseFacility),
                new PropertyMetadata(null));

        /// <summary>
        /// Identifies the OwnerId Property.
        /// </summary>
        public static readonly DependencyProperty OwnerIdProperty =
            DependencyProperty.Register(
                "OwnerId",
                typeof(int?),
                typeof(DatabaseFacility),
                new PropertyMetadata(null));

        /// <summary>
        /// Identifies the Owner Property.
        /// </summary>
        public static readonly DependencyProperty OwnerProperty =
            DependencyProperty.Register(
                "Owner",
                typeof(Agency),
                typeof(DatabaseFacility),
                new PropertyMetadata(null));

        /// <summary>
        /// Identifies the HexId Property.
        /// </summary>
        public static readonly DependencyProperty HexIdProperty =
            DependencyProperty.Register(
                "HexId",
                typeof(int),
                typeof(DatabaseFacility),
                new PropertyMetadata(-1));

        /// <summary>
        /// Identifies the Hex Property.
        /// </summary>
        public static readonly DependencyProperty HexProperty =
            DependencyProperty.Register(
                "Hex",
                typeof(Hex),
                typeof(DatabaseFacility),
                new PropertyMetadata(null));

        /// <summary>
        /// Identifies the ActiveProjectId Property.
        /// </summary>
        public static readonly DependencyProperty ActiveProjectIdProperty =
            DependencyProperty.Register(
                "ActiveProjectId",
                typeof(int?),
                typeof(DatabaseFacility),
                new PropertyMetadata(null));

        /// <summary>
        /// Identifies the ActiveProject Property.
        /// </summary>
        public static readonly DependencyProperty ActiveProjectProperty =
            DependencyProperty.Register(
                "ActiveProject",
                typeof(Project),
                typeof(DatabaseFacility),
                new PropertyMetadata(null));

        /// <summary>
        /// Identifies the QueuedProjects Property.
        /// </summary>
        public static readonly DependencyProperty QueuedProjectsProperty =
            DependencyProperty.Register(
                "QueuedProjects",
                typeof(ObservableCollection<Project>),
                typeof(DatabaseFacility),
                new PropertyMetadata(null));

        /// <summary>
        /// Gets or sets the Id.
        /// </summary>
        
        [DatabaseField("Id", IsIdentity = true, IsKey = true)]
        public int Id
        {
            get { return (int)SafeGetValue(IdProperty); }
            set { SafeSetValue(IdProperty, value); }
        }

        /// <summary>
        /// Gets or sets the FacilityType Id.
        /// </summary>
        
        [DatabaseField("FacilityTypeId", IsKey = true)]
        public int FacilityTypeId
        {
            get { return (int)SafeGetValue(FacilityTypeIdProperty); }
            set { SafeSetValue(FacilityTypeIdProperty, value); }
        }

        /// <summary>
        /// Gets or sets the Owner Id.
        /// </summary>
        
        [DatabaseField("OwnerId")]
        public int OwnerId
        {
            get { return (int)SafeGetValue(OwnerIdProperty); }
            set { SafeSetValue(OwnerIdProperty, value); }
        }

        /// <summary>
        /// Gets or sets the Agency.
        /// </summary>
        
        public Agency Owner
        {
            get { return (Agency)SafeGetValue(OwnerProperty); }
            set { SafeSetValue(OwnerProperty, value); }
        }

        /// <summary>
        /// Gets or sets the Hex Id.
        /// </summary>
        
        [DatabaseField("HexId")]
        public int HexId
        {
            get { return (int)SafeGetValue(HexIdProperty); }
            set { SafeSetValue(HexIdProperty, value); }
        }

        /// <summary>
        /// Gets or sets the Hex.
        /// </summary>
        
        public Hex Hex
        {
            get { return (Hex)SafeGetValue(HexProperty); }
            set { SafeSetValue(HexProperty, value); }
        }

        /// <summary>
        /// Gets or sets the Active Project Id.
        /// </summary>
        
        [DatabaseField("ActiveProjectId")]
        public int ActiveProjectId
        {
            get { return (int)SafeGetValue(ActiveProjectIdProperty); }
            set { SafeSetValue(ActiveProjectIdProperty, value); }
        }

        /// <summary>
        /// Gets or sets the Active Project.
        /// </summary>
        
        public Project ActiveProject
        {
            get { return (Project)SafeGetValue(ActiveProjectProperty); }
            set { SafeSetValue(ActiveProjectProperty, value); }
        }

        /// <summary>
        /// Gets or sets the Queued Projects.
        /// </summary>
        
        public ObservableCollection<Project> QueuedProjects
        {
            get { return (ObservableCollection<Project>)SafeGetValue(QueuedProjectsProperty); }
            set { SafeSetValue(QueuedProjectsProperty, value); }
        }

        public DatabaseFacility()
        {
        }

        public DatabaseFacility(LinkedDependencyObject baseObject)
            : base(baseObject)
        {
        }

        public DatabaseFacility(LinkedDependencyObject baseObject, BindingMode bindingMode)
            : base(baseObject, bindingMode)
        {
        }

        public override void LoadAllPropertyObjects()
        {
            #warning Not Implemented
        }

        public override void LoadPropertyObject(string propertyName)
        {
            #warning Not Implemented
        }
    }
}
